import App from './App'
import uviewPlus from '@/uni_modules/uview-plus'
// import components from '/exportComponents/index.js'
import Index from '/exportComponents/components/index'
import my from '/exportComponents/components/my'
import exhibition from '/exportComponents/components/exhibition'

// #ifndef VUE3
import Vue from 'vue'
import './uni.promisify.adaptor'
Vue.config.productionTip = false
App.mpType = 'app'
const app = new Vue({
	...App
})
app.$mount()
// #endif

// #ifdef VUE3

import {
	createSSRApp
} from 'vue'
const apiContext = import.meta.glob('./api/apis/*.js', {
	eager: true
});
export function createApp() {
	const app = createSSRApp(App)
	const apis = {}
	for (const key in apiContext) {
		const apiModule = apiContext[key];
		for (const apiName in apiModule) {
			if (!apis[apiName]) {
				apis[apiName] = {};
			}
			app.provide(apiName + '', apiModule[apiName])
		}
	}
	app.provide('$uploadHttp', 'https://px.aibaiba.com/api/Upload/upload')
	app.use(uviewPlus)
	app.component('Index', Index)
	app.component('My', my)
	app.component('Exhibition', exhibition)

	app.mount('#app');
	return {
		app
	}
}
// #endif